const app = getApp()


Page({
  data: {
    index: 0,
    page: 0,
    arr: [],
    isFirstLoad: true

  },
  onReady: function () {
    wx.startPullDownRefresh();
  },

  onPullDownRefresh: function () {
    console.log("下拉");
    this.setData({
      "page": 0

    });
    this.loadData();

  },
  onReachBottom: function () {
    console.log("上拉");
    this.setData({
      "page": this.data.page + 1
    });

    this.loadData();
  },

  loadData: function () {
    console.log(this.data.page);
    app.func.request("http://localhost/wxapi/test.php", "GET", { "name": 3 }, this.ok);
  },
  ok: function (res) {
    console.log(res);
    wx.stopPullDownRefresh();

    var arr = [];
    for (var i = 0; i < 100; i++) {
      arr[i] = i + 1;
    }
    this.setData({
      "arr": arr
    });
  }






})